home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 21 / CU Amiga Magazine's Super CD-ROM 21 (1998)(EMAP Images)(GB)[!][issue 1998-04].iso / CUCD / Programming / gtdrag / include / libraries / gtdrag.h
Encoding:
C/C++ Source or Header  |  1997-09-27  |  3.2 KB  |  100 lines

  1. #ifndef LIBRARIES_GTDRAG_H
  2. #define LIBRARIES_GTDRAG_H 1
  3. /*
  4. **  $VER: gtdrag.h 2.1 (14.12.96)
  5. **  Includes Release 2.10
  6. **
  7. **  Drag&Drop with GadTools
  8. **
  9. **  (C) Copyright 1996 Axel Dörfler
  10. **      All rights Reserved
  11. */
  12.  
  13. #include <exec/nodes.h>
  14. #include <utility/hooks.h>
  15.  
  16. /* The ImageNode structure is used to have both text and images in a listview.
  17.  * A render hook for this type is provided. It is not a must!
  18.  */
  19.  
  20. struct ImageNode
  21. {
  22.   struct Node *in_Succ;
  23.   struct Node *in_Pred;
  24.   UBYTE  in_Type;
  25.   BYTE   in_Pri;
  26.   STRPTR in_Name;
  27.   struct Image *in_Image;
  28. };
  29.  
  30. /* The DragGadget structure manages the gadgets which support dragging.
  31.  * Remember that these fields are read-only!
  32.  */
  33.  
  34. #define DGF_IMAGES 1       /* Images only, if possible */
  35. #define DGF_NODRAG 2       /* can't be the source of a drag */
  36. #define DGF_SAME 4         /* icon can be dragged over the same gadget */
  37. #define DGF_NOPOS 8        /* no positioning, listview only */
  38.  
  39. struct DragGadget
  40. {
  41.   struct MinNode dg_Node;
  42.   struct Gadget *dg_Gadget;
  43.   struct Window *dg_Window;
  44.   struct Task *dg_Task;       /* pointer to the owner task */
  45.   struct List *dg_List;
  46.   struct Hook *dg_Render;
  47.   ULONG  dg_Type;
  48.   ULONG  dg_Mask,dg_AcceptMask;
  49.   WORD   dg_ItemHeight;
  50.   WORD   dg_Width;
  51.   WORD   dg_Height;
  52.   UWORD  dg_Flags;
  53. };
  54.  
  55. /* You receive the DragMsg structure if someone has dragged an item.
  56.  * And again, all fields are read-only!
  57.  */
  58.  
  59. #define DMT_GADGET 1    /* target is a window */
  60. #define DMT_WINDOW 2    /* target is a gadget */
  61. #define DMT_UNKNOWN 4   /* target doesn't support drag&drop */
  62.  
  63. struct DragMsg
  64. {
  65.   struct MinNode dm_Node;
  66.   ULONG  dm_Type;
  67.   struct ImageNode *dm_Object;  /* dragged object */
  68.   struct DragGadget *dm_Source;
  69.   STRPTR dm_SourceApp;          /* owner Name or NULL for your own */
  70.   APTR   dm_Target;             /* pointer to a DragGadget or Window */
  71.   LONG   dm_SourceEntry;        /* the list position of the entry */
  72.   LONG   dm_TargetEntry;        /* dto. - may be higher than the number of entries */
  73.   LONG   dm_X,dm_Y;             /* exact co-ordinates */
  74. };
  75.  
  76. /* The flags for the IDCMP-MsgPort of your Window */
  77.  
  78. #define DRAGIDCMP (LISTVIEWIDCMP | IDCMP_MOUSEBUTTONS)
  79.  
  80. /* Tags to pass to GTD_AddGadget() */
  81.  
  82. #define GTDA_TagBase    (TAG_USER + 0x90000)
  83. #define GTDA_ItemHeight GTDA_TagBase + 1      /* height of a listview entry */
  84. #define GTDA_RenderHook GTDA_TagBase + 2      /* render hook for listview */
  85. #define GTDA_Images     GTDA_TagBase + 3      /* drags only images (listview MUST contain ImageNodes) */
  86. #define GTDA_Width      GTDA_TagBase + 4      /* width of icon (only for GTDA_RenderHook & GTDA_Images) */
  87. #define GTDA_Height     GTDA_TagBase + 5      /* height of a icon ("") */
  88. #define GTDA_NoDrag     GTDA_TagBase + 6      /* do not drag from this gadget */
  89. #define GTDA_Object     GTDA_TagBase + 7      /* drag node from a non-listview */
  90. #define GTDA_Same       GTDA_TagBase + 8      /* set DGF_SAME */
  91. #define GTDA_Mask       GTDA_TagBase + 9      /* mask value */
  92. #define GTDA_AcceptMask GTDA_TagBase + 10     /* accept mask value */
  93. #define GTDA_NoPosition GTDA_TagBase + 11     /* set DGF_NOPOS */
  94.  
  95. /* Tags to pass to GTD_AddApp() */
  96.  
  97. #define GTDA_InternalOnly  GTDA_TagBase + 42   /* drags only internally */
  98.  
  99. #endif
  100.